//
//  LLNetworkServiceManager.h
//  LLFoundation
//
//  Created by my_liu on 2016/11/14.
//  Copyright © 2016年 .All rights reserved.
//

#import <Foundation/Foundation.h>
#import "LLNWHTTPConnection.h"

typedef void(^LHttpSuccessBlock)(id responseObj , NSDictionary *userInfo);
typedef void(^LHttpFailBlock)(NSError *error , NSDictionary *userInfo);

@interface LLNetworkServiceManager : NSObject

+ (instancetype)share;

/**
 *  获取默认header字典
 *
 *  @return 获取默认header字典
 */
- (NSDictionary *)getDefaultHeader;

/**
 *  <#Description#>
 *
 *  @param defaultHeader <#defaultHeader description#>
 */
- (void)setDefaultHeader:(NSDictionary *)defaultHeader;
/**
 
  GET请求
 @param url 请求url
 @param successBlock 请求成功的回调
 @param failBlock 失败的回调
 @param userInfo GET参数
 @return 关联这个请求的hash
 */
- (NSUInteger)requestGetUrl:(NSString *)url successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;
- (NSUInteger)requestGetUrl:(NSString *)url parameters:(id)parameters successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;
- (NSUInteger)requestGetUrl:(NSString *)url header:(NSMutableDictionary *)header successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;
- (NSUInteger)requestGetUrl:(NSString *)url header:(NSMutableDictionary *)header parameters:(id)parameters successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;
/**
 post请求

 @param url 请求url
 @param parameters POST参数
 @param successBlock 请求成功回调
 @param failBlock 失败回调
 @param userInfo 额外的参数
 @return 关联这个请求的hash
 */
- (NSUInteger)requestPostUrl:(NSString *)url parameters:(id)parameters successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;
- (NSUInteger)requestPostUrl:(NSString *)url parameters:(id)parameters header:(NSMutableDictionary *)header successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;
- (NSUInteger)requestPostUrl:(NSString *)url parameters:(id)parameters body:(NSString *)body successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;
- (NSUInteger)requestPostUrl:(NSString *)url header:(NSMutableDictionary *)header body:(NSString *)body successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;
- (NSUInteger)requestPostUrl:(NSString *)url parameters:(id)parameters header:(NSMutableDictionary *)header body:(NSString *)body successBlock:(LHttpSuccessBlock)successBlock failBlock:(LHttpFailBlock)failBlock userInfo:(NSDictionary *)userInfo;

/**
 *  取消这个请求
 *
 *  @param reqId 关联这个请求的hash
 */
- (void)cancelRequestByReqId:(NSUInteger)reqId;

/**
 *  取消所有的请求
 */
- (void)cancelAllRequest;
@end
